<!DOCTYPE html>
<html 
<head >
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css"  media="all"/>
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all"/>
<link rel="stylesheet"  href="../../../css/common/loader.css" media="all"/>
<link rel="stylesheet"  href="../../../css/common/tablepage.css" media="all"/>
</head>
<style>
	#orderTimeStart{margin-right:5px;}
	#orderTimeEnd{margin-left:5px;}
	#orderTimeStart,#orderTimeEnd{display: inline-block;position: relative;top:-3px;}
</style>
<body>
	<div class="layui-fluid">
		<div class="layui-card">
			<div class="layui-form layui-card-header layuiadmin-card-header-auto" id="searchForm">
			   <div class="layui-form-item">

                 <div class="layui-inline">
				  <label class="layui-form-label">注文番号</label>
				  <div class="layui-input-block">
				  <input type="text" name="orderId" class="layui-input">
				   </div>
				 </div>

                 <div class="layui-inline">
				  <label class="layui-form-label">卓番</label>
				  <div class="layui-input-block">
				  <input type="text" name="deskName"  class="layui-input">
				   </div>
				 </div>
                   <div class="layui-inline">
						<label class="layui-form-label">時間</label>
						<div class="layui-input-block" >
							<input type="text" name="orderTimeStart" id="orderTimeStart"
								autocomplete="off" class="layui-input">-<input type="text" name="orderTimeEnd" id="orderTimeEnd"
								autocomplete="off" class="layui-input">
						</div>
					</div>
				 <div class="layui-inline">
				  <button class="layui-btn layuiadmin-btn-sm" lay-submit
							lay-filter="searchSubmit"  >検索</button>
				</div>
				</div>
			</div>
			<div class="layui-card-body">
				<table id="dataList" lay-filter="dataList" ></table>
				
	
			</div>
		</div>
	</div>
<div type="text/html" id="trTool" style="display:none">
   {{#  if(d.whetherPay === '0'){ }}
    <a  data-grant="buss:order:pay" class="layui-btn layui-btn-sm" lay-event="pay"><i class="layui-icon layui-icon-ok"></i>完了する</a>
    {{#  } }}
   {{#  if(d.whetherPay === '1'){ }}
    <a  data-grant="buss:order:payWay" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="payWay"><i class="layui-icon layui-icon-edit"></i>決済変更</a>
    {{#  } }}
    <a  data-grant="buss:order:detail" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail"><i class="layui-icon layui-icon-search"></i>詳細</a>
    <a  data-grant="buss:order:remove" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>削除</a>
</div>

<div type="text/html" id="toolbar" style="display:none" >
<div class="layui-btn-container">
     <button data-grant="buss:order:add"   class="layui-btn layui-btn-sm" lay-event="add"> <i class="layui-icon layui-icon-add-1"></i>新增</button>
</div>
</div>
<script   src="../../../layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="../../../lib/jQuery-2.2.0.min.js" ></script>
	<script>
		layui.config({
			base :  '../../../layuiadmin/' //静态资源所在路径
		}).extend({
			webplus : 'lib/webplus'//主入口模块
			
		}).use([ 'table','form','laydate', 'webplus' ], function() {
			var $ = layui.$,
			webplus=layui.webplus,
			form = layui.form,
			laydate = layui.laydate, 
			table = layui.table;
			//日期
			laydate.render({
				elem : '#orderTimeStart'
			});
			//日期
			laydate.render({
				elem : '#orderTimeEnd'
			});
		   var cols= [ [ {
				type : 'numbers',
				title : '番号'
			}, {
				field : 'orderId',
				title : '注文番号',
				width:200
			},
            {
			 field : 'deskName',
			 title : '卓番',
			 width:120
			},
            {
			 field : 'totalAmount',
			 title : '金額',
			 width:150,
			 templet:function(d){
				 
				 return webplus.number_format(d.totalAmount,0,"",",");
			 }
			},
           
            {
			 field : 'orderTime',
			 title : '時間',
			 width:180
			},
			 {
				 field : 'whetherPay_dict',
				 title : '状態',
				 width:150
			},
	         
            {

				title : '編集',
				toolbar : '#trTool',
				fixed: 'right',
				width :280
			} ] ];
		   webplus.init('buss/order/list',cols,'','','','-1')
			 //监听行工具事件
			  table.on('tool(dataList)', function(rowObj){
			    switch(rowObj.event){
			    case 'detail':
		    		webplus.openDetailWindow('showOrder.html','詳細',rowObj,'orderId','','700','560');
		       		
		   			break;
			    case 'payWay':
		    		webplus.openEditWindow('updatePayWay.html','決済変更',rowObj,'orderId','','500','400');
		       		
		   			break;
		    	case 'pay':
			    	
			        webplus.removeRow('buss/order/payOrder',rowObj,'orderId','','','注文を完了しますか');
		    		break;
		    	case 'remove':
			    	
			        webplus.removeRow('buss/order/remove',rowObj,'orderId','','','注文情報を削除しますか？');
		    		break;
			    }
			  });
			 //监听表头按钮事件
			  table.on('toolbar(dataList)', function(obj){
			    switch(obj.event){
			      	case 'add':
				         //打开添加弹出框
				         webplus.openWindow('addOrder.html','新增','700','560');
			     	     break;
			    }
			  });

		});
	</script>

</body>
</html>